package com.jxd.petMgr.util;

/**
 * @author lzh
 * @version 1.0
 * @Description
 * @date 2021/11/22
 */


public class PageUtil {
    private  int count;//总条数
    private  int currentPage;//当前页
    private  int start;//查询起始下标
    private  int limit;//每一页多少条
    private  int PageCount;//总页数

    //参数：当前页    给查询起始下标赋值
    public int getStart(){
        //起始下标=(当前页-1)*每页多少条
        start = (currentPage - 1) * limit;
        return start;

    }

    public void setStart(int start) {
        this.start = start;
    }

    public void setPageCount(int pageCount) {
        PageCount = pageCount;
    }

    //获取总页数
    public  int getPageCount(){
        //刚好整除   总条数/每页多少条
        //有余数   总条数/每页多少条+1
        if(count % limit == 0){
            return  count/limit;
        } else {
            return  count/limit + 1;
        }
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }



    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}
